<%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>

<fmt:bundle basename="application" >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%@ include file="/common/incmnt.jsp"%>
<title>レース情報メンテナンス</title>
<script type="text/JavaScript">
$(function(){
	$("#raceInfoArea").show();
	$("#srcRace").bind("click",srcRace_click);
	$("#regRace").bind("click",regRace_click);
	$("#delRace").bind("click",delRace_click);
	$("#calcRace").bind("click",calcRace_click);
});

function srcRace_click(e){
	query = {};
	query[REQKEY_COMMAND] = REQKEY_COMMAND_SEARCH;
	query["raceKey"] = $(".key:checked").val();
	b_ajax("/mnt/raceInfo",query,setResponseData);
}

function regRace_click(e){
	query = {};
	query[REQKEY_COMMAND] = REQKEY_COMMAND_REGIST;
	query["raceKey"] =$("#key").val();
	query["raceInfo"] =$.toJSON(getInput("#raceInfoArea"));
	b_ajax("/mnt/raceInfo",query);
}

function delRace_click(e){
	query = {};
	query[REQKEY_COMMAND] = REQKEY_COMMAND_DELETE;
	query["raceKey"] = $(".key:checked").val();
	b_ajax("/mnt/raceInfo",query);
}

function calcRace_click(e){
	query = {};
	query[REQKEY_COMMAND] = "calcHandicap";
	query["raceKey"] = $(".key:checked").val();
	b_ajax("/mnt/raceInfo",query,setResponseData);
}

</script>
</head>
<body>
<form action="${f:url('index')}" method="post">
<input type="submit" value="戻る"/>
</form>
<div id="messageArea"><span id="message"></span></div>
<div id="raceArea">
	<c:forEach var="race" items="${raceList}">
	<div id="raceLine">
		<label>
		<input type="radio" class="key" name="raceKey" value="${f:h(race.key)}"/>
		<c:out value="${race.raceDate}" />
		<c:out value="${race.raceName}" escapeXml="false"/>
		</label>
	</div>
	</c:forEach>
</div>
<div class="btnArea">
<a href="javascript:void(0);" id="srcRace" class="btn" ><span><fmt:message key="btn.search"/></span></a>
<a href="javascript:void(0);" id="regRace" class="btn" ><span><fmt:message key="btn.regist"/></span></a>
<a href="javascript:void(0);" id="delRace" class="btn" ><span><fmt:message key="btn.delete"/></span></a>
<a href="javascript:void(0);" id="calcRace" class="btn" ><span>配当計算</span></a>
</div>
<div id="raceInfoArea">
	<div id="raceInfo" class="raceInfo"></div>
</div>
</body>
</html>
</fmt:bundle>
